<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>
<?php require_once ('partial/message.php'); ?>

<form action="<?php echo site_url('ranking/post_an_item');?>" name="form_post_an_item" id="form_post_an_item" method="post" enctype="multipart/form-data" >
	<input type="hidden" name="post_tokenID" id="post_tokenID" value="<?php echo $tokenID;?>"/>
	<input type="hidden" name="post_user_id" id="post_user_id" value="<?php echo $user_id;?>"/>

	<input type="hidden" name="lat" id="lat" value="36" />
	<input type="hidden" name="long" id="long" value="138" />
	<input type="hidden" name="image_uploaded_1" id="image_uploaded_1" value=""/>
	<input type="hidden" name="image_uploaded_2" id="image_uploaded_2" value=""/>
	<input type="hidden" name="image_uploaded_3" id="image_uploaded_3" value=""/>
	
<!-- Add content-->
<div class="wrap-content border">
	<section id="add-data">
		<div class="row">
			<div class="left"><label><?php echo lang('ranking.add.form.name');?></label></div>
			<div class="right">
				<input type="text" id="name_item" required="required" name="name_item" 
				 maxlength="200" size="70" />
				<div class="clrboth"></div>	
				 
				 <div class="hidden" id="check_duplicate_name">
				 	<?php echo lang('ranking.check.duplicate.name')?>
				 </div>
				 
				<div class="hidden error" id="check_duplicate_name_error">
				 	<?php echo lang('ranking.check.duplicate.name.error')?>
				</div>  
					
			</div>
		</div>
		
		<div class="clrboth"></div>	
		<div class="row">
			<div class="left"><label><?php echo lang('ranking.add.form.dish_name');?></label></div>
			<input type="text" id="dish_name" name="dish_name" maxlength="200" size="70" />	
		</div>
		
		<div class="row">
			<div class="left"><label><?php echo lang('ranking.add.form.address');?></label></div>
			<div class="right">
				<div class="left"><?php echo lang('ranking.add.form.state');?></div> 
								<div class="right"><div id="region_"><?php echo $regions ?></div> </div> <br/>
								
				<div class="left"><?php echo lang('ranking.add.form.city');?></div> 
							<div class="right"> 
								<div id="city_"><?php echo $cities ?></div> 
							 </div> 
						 	<br/>
							
				<div class="left"><?php echo lang('ranking.add.form.details');?></div> 
					<div class="right"> 
						<input type="text" id="details" name="details" size="53" maxlength="250" />
					</div> <br/>
				
				<div class="left">&nbsp;</div> <div class="right"> <div id="google_map_add_form"></div> </div>
			</div>
		</div>

		<div class="row">
			<div class="left"><label><?php echo lang('ranking.add.form.url');?></label></div>
			<div class="right">
				<input type="text" name="user_url" id="user_url" 
						maxlength="250" size="70" />
			</div>
		</div>

		<div class="row">
			<div class="left"><label><?php echo lang('ranking.add.form.image');?></label></div>
			<div class="right">
				<div class="wrap-170"> 
					<div class="image-wrap">
						<div id="preview_1"></div>
					</div>
					
					<div class="clrboth"></div>
					
					<input type="button" name="image_selected1" id="image_selected1" rel="select_image"
							value="<?php echo lang('ranking.add.form.check_to_change');?>" onclick="select_image_google_API(this,1)" /> 
						 	
						<br />	
					<input type="radio" name="image_selected" id="image_selected1"  
							value="1" checked="checked" />	
						<?php echo lang('ranking.add.form.select');?> 
				</div>	
				<div class="wrap-170"> 
					<div class="image-wrap">
						<div id="preview_2"></div>
					</div>
					
					<div class="clrboth"></div>
					
					<input type="button" name="image_selected2" id="image_selected2" rel="select_image"
							value="<?php echo lang('ranking.add.form.check_to_change');?>" onclick="select_image_google_API(this,2)" /> 
						<br />	
					<input type="radio" name="image_selected" id="image_selected2"  
							value="2" />	
						<?php echo lang('ranking.add.form.select');?>  
				</div>
				<div class="wrap-170"> 
					<div class="image-wrap">
						<div id="preview_3"></div>
					</div>
					
					<div class="clrboth"></div>
					
					<input type="button" name="image_selected3" id="image_selected3" rel="select_image"
							value="<?php echo lang('ranking.add.form.check_to_change');?>" onclick="select_image_google_API(this,3)" /> 
						<br />	
					<input type="radio" name="image_selected" id="image_selected3"  
							value="3" />
						<?php echo lang('ranking.add.form.select');?>  
				</div>
				<br/>
				 <div class="hidden" id="selected_image_err">
				 	<?php echo lang('ranking.add.form.select.image.error')?>
				 </div>
			</div>
		</div>
		
		<div class="row">
			<div class="left"><label><?php echo lang('ranking.add.form.google_image');?> </label></div>
			<div class="right">
				<input type="text" id="google_image" name="google_image" size="70"/>
				<input type="button" id="google_image_button" value="<?php echo lang('ranking.add.form.search');?>" onclick="google_image_search();" />
			</div>
		</div>
		
		<div class="row">
			<div class="left"><label><?php echo lang('ranking.add.form.image1');?></label></div>
			<div class="right">
				<input type="file" id="image1" name="image1" size="65" 
				onchange="fileUpload(this.form,'iF_proc_image_preview/1','image_upload_stt1','preview_1','upload_iframe1');" />
				<br/>
				<div id="image_upload_stt1">
					<div class="hidden">
				 		<?php echo lang('ranking.upload.image_1.error')?>
				    </div>
				</div>
			</div>
		</div>
		
		<div class="row">
			<div class="left"><label><?php echo lang('ranking.add.form.image2');?></label></div>
			<div class="right">
				<input type="file" id="image2" name="image2" size="65" 
				onchange="fileUpload(this.form,'iF_proc_image_preview/2','image_upload_stt2','preview_2','upload_iframe2');" />
				<br/>
				<div id="image_upload_stt2">
					<div class="hidden">
				 		<?php echo lang('ranking.upload.image_2.error')?>
				    </div>
				</div>
			</div>
		</div>

		<div class="row">
			<div class="left"><label><?php echo lang('ranking.add.form.image3');?></label></div>
			<div class="right">
				<input type="file" id="image3" name="image3" size="65" 
				onchange="fileUpload(this.form,'iF_proc_image_preview/3','image_upload_stt3','preview_3','upload_iframe3');" />
				<br/>
				<div id="image_upload_stt3">
					<div class="hidden">
				 		<?php echo lang('ranking.upload.image_3.error')?>
				    </div>
				</div>
			</div>
		</div>
		
		<div class="row">
			<div class="left"><label><?php echo lang('ranking.add.form.else');?></label></div>
			<div class="right">
				<textarea cols="60" rows="5" id="elsewhat" name="elsewhat" maxlength="1000" ></textarea>
			</div>
		</div>
		
		<div class="row">
			<div class="left">&nbsp;</div>
			<div class="right">
				<div class="left"><input id="btn_OK" style="cursor:pointer;" type="button" onclick="javascript:submit_form_add_item();" value="<?php echo lang('ranking.add.form.ok');?>" /></div>
				<div class="left"><input id="btn_cancel" style="cursor:pointer;" type="button" onclick="javascript:window.location= BASE_URI+'ranking';"  value="<?php echo lang('ranking.add.form.cancel');?>" /></div>
			</div>
		</div>

	</section>
</div>
<div class="clrboth"></div>
<!-- end add content -->

</form>